#ifndef HELPERS_H
#define HELPERS_H

#include <QtGui>
#include <QtXml>
#include "myeeprom.h"


void populateSwitchCB(QComboBox *b, int value);
void populateCurvesCB(QComboBox *b, int value);
void populateSourceCB(QComboBox *b, int value=0);
void populateCSWCB(QComboBox *b, int value);
QString getSourceStr(int typ);
QString getDestStr(int idx=0);
QString getSWName(int val);
QString getCSWFunc(int val);

int  loadiHEX(QWidget *parent, QString fileName, quint8 * data, int datalen, QString header);
bool saveiHEX(QWidget *parent, QString fileName, quint8 * data, int datalen, QString header);

void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value);
void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false);
void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size);

QDomElement getModelDataXML(QDomDocument * qdoc, EEPROMData * tgen);
bool loadModelDataXML(QDomDocument * qdoc, EEPROMData * tmod); // get data from XML

#endif // HELPERS_H
